#include <bits/stdc++.h>
using namespace std;
#define IOS() ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define int long long
#define pb(x) push_back(x)
#define mp make_pair
#define fir first
#define se second
#define pii pair<int,int>
int a[100005],ti[100005];
set<int> ap;
set<pii> s;
signed main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    IOS();
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i],ti[a[i]]++,ap.insert(a[i]);
    for(int i:ap){
        // cout<<i<<endl;
        // for(auto j:s)
        //    cout<<j.fir<<" "<<j.se<<endl; 
        int x=ti[i];
        while(s.size()){
            auto p=*s.begin();
            s.erase(s.begin());
            int lst=p.se;
            if(x>=lst)
                x-=lst;
            else{
                lst-=x;
                x=0;
                // cout<<p.fir<<" "<<lst<<endl;
                s.insert(mp(p.fir,lst));
                break;
            }
        }
        s.insert(mp(-i,ti[i]));
    }
    int ans=0;
    for(auto i:s)
        ans+=i.se;
    cout<<ans<<endl;
    return 0;
}